﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DesignPattern.FactoryPattern
{
    public class OperationFactory
    {
        private Operation opr;
        public Operation CreateOperation(string opt)
        {
            
            switch (opt)
            {
                case "+":
                    opr=new OperationAdd();
                    break;
                case "-":
                    opr = new OperationSub();
                    break;
                case "×":
                    opr =new OperationMul();
                    break;
                case "÷":
                    opr = new OperationDiv();
                    break;
                default:
                    break;
            }
            return opr;
        }
    }
}
